package com.myway.core.common;


import java.util.HashMap;

public enum OutTicketPayStatus {
	PENDING("PEND"), PAID("PAID"), FAIL("FAIL"),REFUNDING("REFUNDING"),REFUNDED("REFUNDED");

	private final String alias;
	private static HashMap<String, OutTicketPayStatus> map;

	/**
	 * Construct the hash map at load time
	 */
	static {
		map = new HashMap<String, OutTicketPayStatus>();
		for (OutTicketPayStatus type : OutTicketPayStatus.values()) {
			map.put(type.alias, type);
		}
	}

	OutTicketPayStatus(String alias) {
		this.alias = alias;
	}

	@Override
	public String toString() {
		return this.alias;

	}

	/**
	 * Return a <code>PayStatus</code> object holding the value of specified alias name
	 * @param alias the alias name of the type
	 * @return a <code>PayStatus</code> object holding the value represented by the alias name argument
	 */
	public static OutTicketPayStatus valueOfAlias(String alias) {
		OutTicketPayStatus type = map.get(alias);

		if (type == null) {
			throw new IllegalArgumentException("Unknown pay status alias [" + alias + "]");
		}

		return type;
	}

}